Skip to content

OPL-1384: Add seed-based encrypted DM methods to MasterID#7

Open
rohenaz wants to merge 1 commit intomasterfrom
OPL-1384-encrypted-dm-methods
Open

OPL-1384: Add seed-based encrypted DM methods to MasterID#7
rohenaz wants to merge 1 commit intomasterfrom
OPL-1384-encrypted-dm-methods

Conversation

@rohenaz
Copy link
Member

@rohenaz rohenaz commented Mar 18, 2026

Summary

  • Adds encryptWithSeed(), decryptWithSeed(), and getEncryptionPublicKeyWithSeed() to the MasterID class for friend-specific ECIES encryption
  • Uses Type42 (BRC-42) key derivation in Type42 mode and hash-based path derivation in BIP32 mode, with a shared private #deriveKeyFromSeed() helper
  • Each friend pair derives unique key pairs from each other's BAP IDs as seeds, enabling peer-to-peer encrypted messaging without transmitting private keys

Test plan

  • 99 tests pass across 5 test files (no regressions)
  • New tests/encrypted-dm.test.ts covers:
    • Public key derivation (determinism, uniqueness per seed/identity)
    • Alice-to-Bob and Bob-to-Alice round-trip encryption/decryption
    • Edge cases: empty string, unicode, CJK, large data, number array input
    • Base64 output format verification
    • Deterministic ciphertext behavior (expected with noKey ECIES)
    • Security: wrong seed, wrong counterparty key, third-party decryption, corrupted ciphertext all throw
    • BIP32 mode: key derivation, round-trip, determinism
    • Cross-mode: Type42 user communicating with BIP32 user

Add encryptWithSeed(), decryptWithSeed(), and getEncryptionPublicKeyWithSeed()
to MasterID for friend-specific ECIES encryption using Type42/BIP32 key
derivation. Each friend pair derives unique keys from each other's BAP IDs,
enabling peer-to-peer encrypted messaging without sharing private keys.
@linear
Copy link

linear bot commented Mar 18, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant